package top.yaofengqiao.springcloudsimple.demo.biz.trigger.http.app;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.yaofengqiao.springcloudsimple.common.util.R;

import javax.annotation.security.PermitAll;

/**
 * @author yfq
 * @date 2024/5/25 11:38
 * @description
 */
@RestController
@RequestMapping("/appTest")
public class AppTestController {

    @PermitAll
    @GetMapping("/testPermit")
    public R<String> hello() {
        return R.ok("testPermit success");
    }

    @PermitAll
    @GetMapping("/testPermitPathVariable/{userId}")
    public R<String> hello(@PathVariable("userId") long userId) {
        return R.ok("testPermitPathVariable success userId:" + userId);
    }

    @GetMapping("/testAuth")
    public R<String> testAuth() {
        return R.ok("testAuth success");
    }

    @GetMapping("/testAuthPathVariable/{userId}")
    public R<String> testAuth(@PathVariable("userId") long userId) {
        return R.ok("testAuthPathVariable success userId:" + userId);
    }

}
